import classNames from "classnames";
import Upload, { type UploadProps } from "rc-upload";
import React from "react";

interface UploadExtendProps extends UploadProps {
  className?: string;
  children: React.ReactNode;
}
export const NUpload = React.memo(({ className, children, ...restProps }: UploadExtendProps) => {
  const uploaderProps: UploadProps = {
    action: ((window as any).__ENV_JL__ || {}).baseURL + "/upload",
  };
  {
    return (
      <Upload
        className={classNames(className)}
        style={{
          outline: "none",
        }}
        {...uploaderProps}
        {...restProps}
      >
        {children}
      </Upload>
    );
  }
});
